
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;
using System.Collections;

namespace Swaf.Container
{
	/// <summary>
	/// Summary description for NameAddressSupportDictionaryWrapper.
	/// </summary>
	[Serializable]
	public class NameAddressSupportDictionaryWrapper : IDictionary
	{
		protected INameAddressSupport m_inner;

		public NameAddressSupportDictionaryWrapper(INameAddressSupport inner)
		{
			m_inner = inner;
		}
		public INameAddressSupport InnerElement { get { return m_inner; } set { m_inner = value; } }
		#region IDictionary Members

		public bool IsReadOnly
		{
			get
			{
				return false;
			}
		}

		public IDictionaryEnumerator GetEnumerator()
		{
			// TODO:  Add NameAddressSupportDictionaryWrapper.GetEnumerator implementation
			return m_inner.GetEnumerator() as IDictionaryEnumerator;
		}

		public object this[object key]
		{
			get
			{
				return m_inner == null?null:m_inner.get(key.ToString());
			}
			set
			{
				if(m_inner != null)
					m_inner.put(key.ToString(), value);
			}
		}

		public void Remove(object key)
		{
			//Wrapper doesn't implement this
		}

		public bool Contains(object key)
		{
			return m_inner != null && m_inner.containsField(key.ToString());
		}

		public void Clear()
		{
			//Wrapper doesn't implement this
		}

		public ICollection Values
		{
			get
			{
				//Wrapper doesn't implement this
				return null;
			}
		}

		public void Add(object key, object value)
		{
			if(m_inner != null)
				m_inner.put(key.ToString(), value);
		}

		public ICollection Keys
		{
			get
			{
				//Wrapper doesn't implement this
				return null;
			}
		}

		public bool IsFixedSize
		{
			get
			{
				return false;
			}
		}

		#endregion

		#region ICollection Members

		public bool IsSynchronized
		{
			get
			{
				// TODO:  Add NameAddressSupportDictionaryWrapper.IsSynchronized getter implementation
				return false;
			}
		}

		public int Count
		{
			get
			{
				//Wrapper doesn't implement this
				return 0;
			}
		}

		public void CopyTo(Array array, int index)
		{
			//Wrapper doesn't implement this
		}

		public object SyncRoot
		{
			get
			{
				//Wrapper doesn't implement this
				return null;
			}
		}

		#endregion

		#region IEnumerable Members

		IEnumerator System.Collections.IEnumerable.GetEnumerator()
		{
			return m_inner == null ? null : m_inner.GetEnumerator();
		}

		#endregion
	}
}
